﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.Sockets;

namespace MadLibrary.Net.Ndmp
{
    /// <summary>
    /// Serves as abstract base for NDMP server-side management and holding.
    /// </summary>
    public abstract class Service
    {
        /// <summary>
        /// Gets or sets the client.
        /// </summary>
        /// <value>
        /// The client.
        /// </value>
        public IPEndPoint Client { get; set; }
        /// <summary>
        /// Initializes a new instance of the <see cref="Service"/> class.
        /// </summary>
        public Service()
        {
            this.Client = new IPEndPoint(IPAddress.Any, 0);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="Service"/> class with specified client's end point.
        /// </summary>
        /// <param name="Client">The client.</param>
        public Service(IPEndPoint Client)
        {
            this.Client = Client;
        }

        /// <summary>
        /// Processes the client.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>The response.</returns>
        public virtual Response ProcessClient(Request request)
        {
            return new Response(request.Command, "RESULT DATA", NdmpStatus.Done);
        }
    }
}
